/**
 * Created by guiyongdong on 16/10/11.
 */
import React, { Component } from 'react';
import {
    StyleSheet,
    TabBarIOS
} from 'react-native';

import Home from '../home/Home';
import Category from '../category/Category';
import Found from '../found/Found';
import Shopping from '../shopping/Shopping';
import Profile from '../profile/Profile';


export default class TabBariOS extends Component {
    constructor(props){
        super(props);
        global.BID='56c45924c2fb4e2050000022';
        this.state = {
            tab:'home'
        };
    }
    _selectTabbar(tabName){
        this.setState({
            tab:tabName
        });
    }

    render(){
        return (
            <TabBarIOS style = {styles.flex} tintColor = '#FF6261'>
                <TabBarIOS.Item
                    title = "首页"
                    icon = {require('../resoure/tabbar/homeNormal@3x.png')}
                    onPress = {this._selectTabbar.bind(this,'home')}
                    selected = {this.state.tab === 'home'}
                    selectedIcon =  {require('../resoure/tabbar/homeHight@3x.png')}>
                    <Home
                        style={styles.flex}
                    />
                </TabBarIOS.Item>

                <TabBarIOS.Item
                    title = "分类"
                    icon = {require('../resoure/tabbar/categoryNormal@3x.png')}
                    onPress = {this._selectTabbar.bind(this,'category')}
                    selected = {this.state.tab === 'category'}
                    selectedIcon =  {require('../resoure/tabbar/categoryHight@3x.png')}>
                    <Category
                        style={styles.flex}
                    />
                </TabBarIOS.Item>

                <TabBarIOS.Item
                    title = "发现"
                    icon = {require('../resoure/tabbar/foundNormal@3x.png')}
                    onPress = {this._selectTabbar.bind(this,'found')}
                    selected = {this.state.tab === 'found'}
                    selectedIcon =  {require('../resoure/tabbar/foundHight@3x.png')}>
                    <Found
                        style={styles.flex}
                    />
                </TabBarIOS.Item>

                <TabBarIOS.Item
                    title = "购物车"
                    icon = {require('../resoure/tabbar/carNormal@3x.png')}
                    onPress = {this._selectTabbar.bind(this,'car')}
                    selected = {this.state.tab === 'car'}
                    selectedIcon =  {require('../resoure/tabbar/carHight@3x.png')}>
                    <Shopping
                        style={styles.flex}
                    />
                </TabBarIOS.Item>

                <TabBarIOS.Item
                    title = "我的"
                    icon = {require('../resoure/tabbar/meNoraml@3x.png')}
                    onPress = {this._selectTabbar.bind(this,'me')}
                    selected = {this.state.tab === 'me'}
                    selectedIcon =  {require('../resoure/tabbar/meHight@3x.png')}>
                    <Profile
                        style={styles.flex}
                    />
                </TabBarIOS.Item>
            </TabBarIOS>

        );
    }
    
}

const styles = StyleSheet.create({
    flex:{
        flex:1
    }
});




